// components/navbar/index.js
const app = getApp();
Component({
 /**
  * 组件的属性列表
  */
 properties: {
   // 这里定义了innerText属性，属性值可以在组件使用时指定
   name: {
     type: String,
     value: '养博城',
   },
   typeBar: {
     type: Number,
     value: 1,
   },
   share: {
     type: Number,
     value: 2
   },
   background: {
     type: String,
     value: '#666',
     observer(oldvalue,newvalue){
       //console.log(oldvalue,newvalue);
     }
   },
   address:{
     type:String,
     value:'定位'
   }
 },

 /**
  * 组件的初始数据
  */
 data: {
   statusBarHeight: app.globalData.statusBarHeight,
   navbarHeight: app.globalData.navbarHeight,
   menuTop:app.globalData.menuTop,
   menuHeight:app.globalData.menuHeight,
   address:[]
 },
 ready:function(){
    this.setData({
      statusBarHeight: app.globalData.statusBarHeight,
      navbarHeight: app.globalData.navbarHeight,
      menuTop:app.globalData.menuTop,
      menuHeight:app.globalData.menuHeight
    })
 },
 /**
  * 组件的方法列表
  */
 methods: {
  chooseLocationFun(){
    console.log(app.globalData);
    console.log(this.data);
      const myEventDetail = {};
      this.triggerEvent("run",myEventDetail);
  },
   // 返回上一页
   goBack() {
     if (this.data.share == 1) {
       wx.switchTab({
         url: '/pages/tabBar/index/index',
       })
     } else {
       wx.navigateBack()
     }
   },

  // 返回首页
   goHome() {
     wx.switchTab({
       url: '/pages/tabBar/index/index',
     })
   },
   
   // 返回首页
   goBackHome() {
     wx.switchTab({
       url: '/pages/tabBar/index/index',
     })
   },
 }
})